             package com.java.diagnostics.visualizer.recommender;
             
             import com.java.diagnostics.visualizer.data.AggregateData;
             import com.java.diagnostics.visualizer.data.TupleData;
             import com.java.diagnostics.visualizer.gc.recommender.RecommendationPreferenceHelper;
             import com.java.diagnostics.visualizer.parser.vgc.constants.VGCAxes;
             import com.java.diagnostics.visualizer.recommender.util.Messages;
             import com.java.diagnostics.visualizer.recommender.util.RecommendationLabels;
             import java.text.MessageFormat;
             
             public class ConsiderFragmentation
               extends RecommendationBase
               implements Recommendation
             {
               private static final String OPTTHRUPUT = "optthruput";
               private static final String OPTAVGPAUSE = "optavgpause";
               
               public void recommend(AggregateData data)
               {
                 TupleData fragmentation = data.getTupleData("VGCLabels.unusable.heap");
                 Object gcMode = getGCMode(data);
                 
                 if (!"balanced".equals(gcMode))
                 {
                   StringBuffer comment = new StringBuffer();
                   if ((fragmentation != null) && (!fragmentation.isEmpty()))
                   {
                     double meanFragmentation = fragmentation
                       .getMeanY(VGCAxes.PERCENT_SIGN);
                     
                     if (meanFragmentation > this.helper.getFragmentationThreshold()) {
                       comment.append(MessageFormat.format(
                         RecommendationLabels.FRAGMENTATION_WARNING, 
                         new Object[] { new Double(meanFragmentation) }));
                       if ("optavgpause".equals(gcMode))
                       {
                         comment.append(RecommendationLabels.OPTAVGPAUSE_FRAGMENTATION_WARNING);
                         if (genconAvailable(data))
                         {
                           comment.append(RecommendationLabels.JUST_USE_GENCON_FROM_OPTAVGPAUSE);
                         }
                       } else if ("gencon".equals(gcMode))
                       {
                         comment.append(RecommendationLabels.GENCON_FRAGMENTATION_WARNING);
                       } else if ("optthruput".equals(gcMode))
                       {
                         comment.append(RecommendationLabels.OPTTHRUPUT_FRAGMENTATION_WARNING);
                         if (genconAvailable(data))
                         {
                           comment.append(RecommendationLabels.JUST_USE_GENCON);
                         }
                       }
                       
                       if (isSovereign(data))
                       {
                         comment.append(
                           Messages.getString("high.fragmentation.sovereign"));
                       }
                       
                       addWarning(data, comment.toString());
                     }
                   }
                 }
               }
             }


